<?php
if(!isset($intergrated))
{
header('Content-Type: text/xml');
header('Cache-control: no-cache');
}

include_once("../store/other/util/functs.php");
include_once("../store/other/util/util.php");


//load database information
$db_info = get_database_info();

$link = mysql_connect($db_info['db_server'], 'root', $db_info['db_password']); //right now we are hardcoded..
if (!$link) 
{
   die('Could not connect: ' . mysql_error());
}

mysql_select_db($db_info["db_name"]);

$property_name = $_GET['propertyName'];
$data_id = $_GET['dataId'];
$value = $_GET['value'];
$add_remove = $_GET['add_remove'];
databinding_updater($property_name, $data_id, $value, $add_remove);

$funct_name = $_GET['funct_name'];
$input_data = $_GET;
$input_vars = load_input_vars_from_data($input_data);
$output_vars = NULL;
//input some standard sys variables
$input_vars['sys']['link'] = $link;
$input_vars['sys']['intergrated'] = $intergrated;

$just_loaded = false;
if (!isset($funct_name) ||$funct_name == "")
{
$just_loaded = true;
$output_vars = page_on_load ($input_vars);
}
$output_vars['sys']['link'] = NULL;
$php_return_data = echo_differences_of($input_vars, $output_vars, $just_loaded);
if(!$intergrated)
{
echo $php_return_data;
}
mysql_close($link);
// Handling the onLoad of Page0 
function Page0_onLoad ($args)
{
$args['page']['x'] =  0 ;
$args['page']['text'] = "something to ask";
return $args;

} // end of the function Page0_onLoad

// Handling the common page_on_load function 
function page_on_load ($input_vars) 
{
// call function for Page0 
$output_vars = Page0_onLoad ($input_vars);
$input_vars = $output_vars; //now input will be last outputs;)
$output_vars["table"] = 
       update_databound_properties(NULL, $input_vars, 1);
return $output_vars;

} // end of the function page_on_load

// the following function will be called by util.php
// to update the values of databound properties
function update_databound_properties($diff_vars, $args, $starter)
{

$table_vars = $args['table'];

return $table_vars;
}
//finally the function for databinding_updater..
//responsible for update the databound properties
function databinding_updater($property_name, $data_id, $value, $add_remove)
{
if($property_name == NULL)
{
 return;
}

$update_query = NULL;


if($update_query != NULL)
{
 $result = mysql_query($update_query) or die ("Error in query: $update_query ".mysql_error());
}
}

?>
